<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="list">
			<view class="text-area" v-for="item in list">
				<text class="title" @click="goPath(item)">{{item.title}}</text>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				title: 'Hello',
				list: [{
					title: '城镇大厅',
					path: 'TownHall',
				}, {
					title: '商店',
					path: 'Shop',
				}, {
					title: '铁匠铺',
					path: 'Blacksmith',
				}, {
					title: '冒险者行会',
					path: 'Guild',
				}, {
					title: '教堂',
					path: 'Church',
				}, {
					title: '女神像',
					path: 'Muse',
				},{
					title: '矿坑',
					path: 'mine',
				}, {
					title: '训练场',
					path: 'Training',
				}]
			}
		},
		onLoad() {
			// 获取数据
			uni.getStorage({
				key: 'accessToken',
				success: function(res) {
					if (!res.data) {
						let url = '/pages/public/login';
						uni.navigateTo({
							url
						})
					}
				},
				fail: function(error) {
					console.log('获取数据失败：', error);
				}
			});
		},
		computed: {
			...mapState(['hasLogin'])
		},
		methods: {
			goPath(item) {
				this.$api.msg('抱歉勇士，尚未完工')
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.list {
		width: 100%;
		display: block;
		height: auto;
	}

	.text-area {
		width: 50%;
		height: 120rpx;
		float: left;
		display: inline-block;
		text-align: center;
		text-decoration: underline;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>